Socket
Socket
Sign inDemoInstall

@fluentui/merge-styles

Package Overview
Dependencies
Maintainers
12
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluentui/merge-styles

Style loading utilities.


Version published
Weekly downloads
214K
increased by4.62%
Maintainers
12
Weekly downloads
 
Created

What is @fluentui/merge-styles?

@fluentui/merge-styles is a utility package for managing CSS-in-JS styles in a performant and scalable way. It allows you to define and merge styles, handle theming, and optimize style rendering.

What are @fluentui/merge-styles's main functionalities?

Defining Styles

This feature allows you to define styles using JavaScript objects. The `mergeStyles` function takes a style object and returns a class name that can be applied to HTML elements.

const { mergeStyles } = require('@fluentui/merge-styles');

const className = mergeStyles({
  backgroundColor: 'blue',
  color: 'white',
  padding: '10px'
});

console.log(className);

Merging Styles

This feature allows you to merge multiple style objects into one. The `mergeStyles` function can take multiple style objects and combine them into a single class name.

const { mergeStyles } = require('@fluentui/merge-styles');

const baseStyle = mergeStyles({
  backgroundColor: 'blue',
  color: 'white'
});

const extendedStyle = mergeStyles(baseStyle, {
  padding: '10px'
});

console.log(extendedStyle);

Theming

This feature allows you to apply themes to your styles. The `loadTheme` function loads a theme, and the `mergeStyles` function can use theme variables in the style definitions.

const { mergeStyles, loadTheme } = require('@fluentui/merge-styles');

loadTheme({
  palette: {
    themePrimary: 'blue',
    themeSecondary: 'green'
  }
});

const themedClassName = mergeStyles({
  backgroundColor: 'themePrimary',
  color: 'themeSecondary'
});

console.log(themedClassName);

Other packages similar to @fluentui/merge-styles

FAQs

Package last updated on 08 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc